import React from 'react';
import { Select } from 'antd';
import { SchemaManageAPI } from '../../type';
interface IPropsType {
  id?: string;
  value?: any;
  onChange?: any;
  opt: SchemaManageAPI.ISearchList;
  type: string;
}

export const SearchSelect: React.FC<IPropsType> = (props) => {
  return (
    <Select
      placeholder={props?.opt?.placeholder}
      allowClear={props?.opt?.allowClear}
      value={props?.value}
      onChange={props?.onChange}
      onSelect={props?.opt?.onSelect}
      mode={props.opt?.mode}
      maxTagCount={props.opt?.maxTagCount}
      filterOption={props.opt?.filterOption}
    >
      {props?.opt?.dataSource &&
        props?.opt?.dataSource?.map((item) => {
          return (
            <Select.Option key={item?.value} value={item?.value}>
              {item?.name}
            </Select.Option>
          );
        })}
    </Select>
  );
};
